package router

import (
	"go-money/api"
	"go-money/tool"

	"github.com/gin-gonic/gin"
)

func InitRouter() {
	r := gin.Default()
	r.Use(tool.Cors()) //跨域处理
	f := r.Group("form")
	{
		f.POST("/addform", api.Addform)
		f.GET("/all", api.Allform)
		f.GET("/time", api.SearchTime)
		f.GET("/searchf", api.Field)
		f.GET("/searchall", api.Searchall)
	}
	c := r.Group("college")
	{
		c.GET("/search", api.Searchcollege)
		c.GET("/searchc", api.Searchc)
		c.POST("/add", api.Addcollege)
		c.POST("/delete", api.Deletecollege)
		c.POST("/delete_c", api.Delete_c)
	}
	field := r.Group("field")
	{
		field.GET("/search", api.Searchfield)
		field.GET("/searchf", api.Searchf)
		field.POST("/add", api.Addfield)
		field.POST("/delete", api.Deletefield)
		field.POST("/delete_f", api.Delete_f)
	}
	r.GET("/download", api.Download)
	r.POST("/time", api.Delete_time)
	r.Run(":8080")
}
